#include "XpBar.h"

XpBar::XpBar(int _posX, int _posY, int _frameX, int _frameY, int _width, int _height, std::string _fileName)
	: ScalingBar(_posX, _posY, _frameX, _frameY, _width, _height, _fileName)
{

}

XpBar::XpBar(int _posX, int _posY, int _frameX, int _frameY, int _width, int _height, std::string _fileName, Pokemon* _pokemon, SDLScene* _scene)
	: ScalingBar(_posX, _posY, _frameX, _frameY, _width, _height, _fileName, _pokemon, _scene)
{
	SetPokemon(_pokemon);
}

void XpBar::SetPokemon(Pokemon* const _pokemon)
{
	m_Pokemon = _pokemon;
	int level = m_Pokemon->GetLevel();
	m_Current = m_Pokemon->GetXP() - (level * level * level);
	m_Max = ((level+1) * (level+1) * (level+1)) - (level * level * level);
}

void XpBar::Update()
{
	int level = m_Pokemon->GetLevel();
	m_Current = m_Pokemon->GetXP() - (level * level * level);
	m_Max = ((level+1) * (level+1) * (level+1)) - (level * level * level);

	ScalingBar::Update();
}